<?php
class House_Model extends CI_Model{
	
	function getRelevantHouses(){
		$sql = 'select h.*, hi.image_path from house h 
				join relevant_house relevant on h.house_id = relevant.house_id
				join house_image hi on h.main_image_id = hi.house_image_id';
		$q = $this->db->query($sql);
		if ($q->num_rows() > 0){
			foreach($q->result() as $row){
				$data[] = $row;
			}
			return $data;
		}
	}
}